﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace HNAlbum.WebControl
{
    /// <summary>
    /// Page message which appears on top to give feed back on user server operation
    /// </summary>
    public partial class PageMessage : System.Web.UI.UserControl
    {
        #region Properties
        public enum MessageType
        {
            Succeed,
            Error,
            Warning,
            Info
        }
        public string Message
        {
            get { return pageMessage.Text; }
            set { pageMessage.Text = value; }
        }
        #endregion

        #region Public methods
        /// <summary>
        /// Show a message
        /// </summary>
        /// <param name="message"></param>
        /// <param name="type"></param>
        public void ShowMessage(string message, MessageType type)
        {
            pageMessage.Text = message;
            switch (type)
            {
                case MessageType.Error:
                    pageMessage.ForeColor = Color.Red;
                    break;
                case MessageType.Succeed:
                    pageMessage.ForeColor = Color.LightGreen;
                    break;
                case MessageType.Warning:
                    pageMessage.ForeColor = Color.Orange;
                    break;
                case MessageType.Info:
                    pageMessage.ForeColor = Color.White;
                    break;
            }
        }
        #endregion

        #region Page events
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        #endregion
    }
}